home *** CD-ROM | disk | FTP | other *** search
-
- /*******************************************************************************
- ********************************************************************************
- ********************************************************************************
-
- PERMISSION TO COPY THIS SOFTWARE IS HEREBY GIVEN BY THE AUTHOR PROVIDED THAT
- THIS LEADING MESSAGE IS INCLUDED IN ALL OF THE RELEVANT SOURCE FILES.
-
- P. SCHMITZ, UNIVERSITY OF KEELE, MAY 1988.
-
-
- ********************************************************************************
- ********************************************************************************
- *******************************************************************************/
- #include "header.h"
- #include "planets.h"
-
-
- updateship(cp)
- register struct player *cp;
- {
- switch (cp->planetno)
- {
- case 1: cp->phaserreach += 2; plotphaserbanks(cp);
- break;
- case 3: cp->energy += 50; cp->maxenergy += 50; plotbattleenergy(cp);
- break;
- case 4: cp->maxphoton +=3; plotphotontorpedos(cp);
- break;
- case 5: cp->maxvel +=1;
- break;
- case 6: cp->phaserpower +=20;
- break;
- case 7: cp->phaserbanks=0; cp->photontorpedos=0;
- plotphotontorpedos(cp); plotphaserbanks(cp);
- break;
- case 8: cp->maxphaser+=10; plotphaserbanks(cp);
- break;
- case 9: cp->photonreach +=3; cp->phaserbanks=cp->maxphaser; cp->photontorpedos=cp->maxphoton;
- plotphotontorpedos(cp); plotphaserbanks(cp);
- break;
- case 10: cp->score += 150; cp->maxenergy+=200; plotmaxenergy(cp);
- plotscore(cp);
- break;
- case 11: cp->photonpower+=300;
- break;
- case 12: cp->phaserpower +=80;
- break;
- case 14: cp->maxvel +=1;
- break;
- case 15: cp->phaserreach +=2; plotphaserbanks(cp);
- break;
- case 16: cp->score+=200; plotscore(cp);
- break;
- case 17: cp->phaserpower+=100; plotphaserbanks(cp);
- break;
- case 19: cp->score +=50; plotscore(cp);
- break;
- case 20: cp->maxphoton+=7; cp->maxphaser+=3;
- plotphotontorpedos(cp); plotphaserbanks(cp);
- break;
- case 21:cp->score=0; plotscore(cp);
- break;
- case 22: cp->score +=50; plotscore(cp);
- break;
- case 23: cp->photonreach +=1; plotphotontorpedos(cp);
- break;
- case 24: cp->maxvel+=1;
- break;
- case 28: cp->score+=cp->score; plotscore(cp);
- cp->maxphoton+=20; cp->maxphaser+=30;
- cp->photontorpedos+=20; cp->phaserbanks+=30;
- cp->photonreach+=5; cp->phaserreach+=5;
- cp->maxenergy+=300;
- plotbattleenergy(cp);
- plotphotontorpedos(cp); plotphaserbanks(cp);
- break;
- default:
- break;
- } /*switch*/
- }
-
- noofplanet(x,y)
- {
- i=0;
- while (!((plan[i].xpos==x)&&(plan[i].ypos==y))) i++;
- return(i);
- }
-
- orbit(cp)
- register struct player *cp;
- {
- int decay,orbitingok;
-
- decay=OFF;
- orbitingok=OFF;
- i=cp->xpos;
- j=cp->ypos;
-
- if (((cp->xvel==0) && (cp->yvel==0))&&
- ((inuniv(i+1,j-1)=='O')||
- (inuniv(i+1,j)=='O')||
- (inuniv(i+1,j+1)=='O')||
- (inuniv(i-1,j-1)=='O')||
- (inuniv(i-1,j)=='O')||
- (inuniv(i-1,j+1)=='O')||
- (inuniv(i,j+1)=='O')||
- (inuniv(i,j-1)=='O')))
- decay=ON;
- if (decay)
- {
- plot1(cp,"Spock : We attempted orbit too close to the planet sir. ");
- plot2(cp,"Most of our energy has been used to keep us in the air. ");
- cp->energy -= 300;
- cp->maxenergy -= 300;
- plotenergy(cp);
- plotmaxenergy(cp);
- return(0);
- }
-
- if ((cp->xvel==0) && (cp->yvel==0))
- {
- if(inuniv(i-2,j+2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-2,j+2);goto label2;}
- if(inuniv(i-2,j+1)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-2,j+1);goto label2;}
- if(inuniv(i-2,j)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-2,j);goto label2;}
- if(inuniv(i-2,j-1)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-2,j-1);goto label2;}
- if(inuniv(i-2,j-2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-2,j-2);goto label2;}
- if(inuniv(i+2,j+2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+2,j+2);goto label2;}
- if(inuniv(i+2,j+1)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+2,j+1);goto label2;}
- if(inuniv(i+2,j)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+2,j);goto label2;}
- if(inuniv(i+2,j-1)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+2,j-1);goto label2;}
- if(inuniv(i+2,j-2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+2,j-2);goto label2;}
- if(inuniv(i+1,j-2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+1,j-2);goto label2;}
- if(inuniv(i,j-2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i,j-2);goto label2;}
- if(inuniv(i-1,j-2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-1,j-2);goto label2;}
- if(inuniv(i+1,j+2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i+1,j+2);goto label2;}
- if(inuniv(i,j+2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i,j+2);goto label2;}
- if(inuniv(i-1,j+2)=='O'){orbitingok=ON;cp->planetno=noofplanet(i-1,j+2);goto label2;}
- }
- label2:
- if (orbitingok==OFF)
- {
- plot1(cp," Spock : Fascinating. I've never attempted to orbit ");
- plot2(cp," a non-existent planet. ");
- } else
- {
- if ((cp->cloakingdevice)||(cp->shields))
- {
- if (cp->shields)
- {
- plot1(cp," ");
- plot2(cp," Orbit while you have your shields are up? Youre kidding!");
- }
- else
- {
- plot1(cp," ");
- plot2(cp," Orbit while you are cloaked? You are optimistic! ");
- }
- } else
- {
- plot1(cp," Sulu : We are now in standard orbit Captain. ");
- plot2(cp,plan[cp->planetno].orbit);
- plotstatus(cp,8);
- }
- }
- }
-
- unorbit(cp)
- register struct player *cp;
- {
- if ((cp->stat==8) && (cp->xvel==0) && (cp->yvel==0))
- {
- plot1(cp," Saavik : Aft impulse thrusters 1/2 impulse power ahead. ");
- plot2(cp," Sulu : Orbit termination completed Captain. ");
- plotstatus(cp,3);
- } else
- {
- plot1(cp,"Chekov : We are not in orbit at the moment!Bones : I best");
- plot2(cp," take you to sick bay and have your brains checked Jim. ");
- }
- }
-
- noland(cp)
- register struct player *cp;
- {
- plot1(cp," A protective shield around this planet makes it ");
- plot2(cp," impossible to beam down sir.This might change. ");
- }
-
- beamdown(cp)
- register struct player *cp;
- {
- if (cp->planets[cp->planetno]>0)
- {
- plot1(cp," We have been to this planet already. You cannot ");
- plot2(cp," beam down twice. ");
- return(0);
- }
- j=cp->planetno;
- switch (j)
- {
- case 2 : if (cp->planets[17]==0) {noland(cp); return(0); } else break;
- case 15 : if (cp->planets[14]==0) {noland(cp); return(0); } else break;
- case 19 : if (cp->planets[18]==0) {noland(cp); return(0); } else break;
- case 26 : if (cp->planets[25]==0) {noland(cp); return(0); } else break;
- case 27 : if (cp->planets[26]==0) {noland(cp); return(0); } else break;
- case 28 : if (cp->planets[27]==0) {noland(cp); return(0); } else break;
- default :
- break;
- }
- plot1(cp," Energizing....................................... ");
- plot2(cp," ");
- cp->oldstat=cp->stat;
- plotstatus(cp,10);
- cp->planets[j]=1;
- for (i=1;i<20;++i)
- {
- poscurs(cp,20,i);
- write(cp->fd,plan[j].land[i-1],57);
- }
- }
-